$(function () {
    getNewsType();
});

function getNewsType() {
    let result = myAjax('/getNewsType', 'get', {});
    let html ="";
    let data = result.list;
    for (let i=0;i<data.length;i++){
        console.log(data[i].id);
        html+='<div onclick="jumpType('+data[i].id+')">\n' +
            '  <div>'+data[i].newsType+'</div>\n' +
            '  </div>';
    }
    $("#newsType").html(html)
}
function jumpType(id) {
    localStorage.setItem("typeId", id);
    //sessionStorage.setItem("userId",id);   本地存储  两种方式都可以
    // window.open("/html/news.html");//页面跳转
    location.assign("/html/news.html");
}